%This is a custom-built function to estimate via OLS and output the
%Eicker-Huber-White heteroskedasticity-consistent sandwich form
function [X,Y,BetaHat,YHat,ehat,Sandwich] = OLSGenericProcessor(X,Y)

n = size(X,1);
X = [ones(size(X,1),1) X];
BetaHat = pinv(X'*X)*(X'*Y);
YHat = X*BetaHat;
ehat = Y-YHat;
QHat = (1/n)*(X'*X);
counter = 0;
OmegaHat = zeros(size(BetaHat,1));
while(counter<n)
    counter = counter + 1;
    OmegaHat = OmegaHat + ((ehat(counter,1))^2)*(X(counter,:)'*X(counter,:));
end
OmegaHat = (1/n) * OmegaHat;
Qinv = pinv(QHat);
Sandwich = Qinv*OmegaHat*Qinv;

end